import request from '@/config/axios'

// ERP 库存预警信息 VO
export interface StockWarningInfoVO {
  id: number // 编号
  warningName: string // 预警名称
  type: string // 产品类型：成品(finished)、零部件(components)
  productId: number // 预警产品编号
  productName: string // 预警产品名称
  warningContent: string // 预警内容
  alarmTime: Date // 报警时间
}

// ERP 库存预警信息 API
export const StockWarningInfoApi = {
  // 查询ERP 库存预警信息分页
  getStockWarningInfoPage: async (params: any) => {
    return await request.get({ url: `/erp/stock-warning-info/page`, params })
  },

  // 查询ERP 库存预警信息详情
  getStockWarningInfo: async (id: number) => {
    return await request.get({ url: `/erp/stock-warning-info/get?id=` + id })
  },

  // 新增ERP 库存预警信息
  createStockWarningInfo: async (data: StockWarningInfoVO) => {
    return await request.post({ url: `/erp/stock-warning-info/create`, data })
  },

  // 修改ERP 库存预警信息
  updateStockWarningInfo: async (data: StockWarningInfoVO) => {
    return await request.put({ url: `/erp/stock-warning-info/update`, data })
  },

  // 删除ERP 库存预警信息
  deleteStockWarningInfo: async (id: number) => {
    return await request.delete({ url: `/erp/stock-warning-info/delete?id=` + id })
  },

  // 导出ERP 库存预警信息 Excel
  exportStockWarningInfo: async (params) => {
    return await request.download({ url: `/erp/stock-warning-info/export-excel`, params })
  },
}